package com.zy.xuanwo.zyc.portal.parser.imp;



import com.zy.xuanwo.zyc.portal.bean.LoginToken;
import com.zy.xuanwo.zyc.portal.parser.BaseParser;

import org.json.JSONException;
import org.json.JSONObject;

/**
 * remarks:
 * Created by ChowYvlChen on 2016/7/5  14:47
 */
public class LoginParser extends BaseParser<LoginToken> {
    @Override
    public LoginToken parserJSON(String jsonStr) throws JSONException {
        LoginToken mLoginToken = null;
        if (super.ParseResultPoly(jsonStr) == null) {
            mLoginToken = new LoginToken();
            JSONObject mJSONObject = new JSONObject(jsonStr);
            if (mJSONObject.has("user_token")) {
                mLoginToken.setUser_token(mJSONObject.getString("user_token"));
            }
            if (mJSONObject.has("user_id")) {
                mLoginToken.setUser_id(mJSONObject.getString("user_id"));
            }
        }
        return mLoginToken;
    }
}
